﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Entity;
using BusinessObject;

namespace GreenLife.Admin
{
    public partial class ChinhSuaTaiKhoan : System.Web.UI.Page
    {
        DataSet ds;
        Users us;
        UserBO usBO = new UserBO();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                selectUser();
            }
        }

        public void selectUser()
        {
            us = new Users();
            string name = Request.QueryString["name"];
            us = usBO.selectUserByName(name);
            txtUser.Text = us.UserName.ToString();
            txtPass.Text = us.Password.ToString();
            txtStatus.Text = us.UserStatus.ToString();
        }

        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            us = new Users();
            us.UserName = txtUser.Text;
            us.Password = txtPass.Text;
            us.UserStatus = Int32.Parse(txtStatus.Text);
            if (usBO.updateUser(us))
            {
                Response.Redirect("DanhSachTaiKhoan.aspx");
            }
        }
    }
}